const router = require("express").Router()

const main = require("../controller/upload")

// 引入上传文件模块
const multer = require("multer");

const storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, 'public/upload')
  },
  filename: function (req, file, cb) {
    cb(null, file.originalname)
  }
})

const upload = multer({ storage: storage })
//图片上传
router.post("/", upload.single("file"), main.upload)
//ai绘图
router.post("/aipainting",main.AIPainting)
module.exports = router